#include<vector>
#include<string>
#include<stack>
using  namespace std;
class Solution {
public:
    int evalRPN(vector<string>& tokens) {
        stack<int> _st;
        for (auto& str : tokens)
        {
            if (str == "+" || str == "-" || str == "*" || str == "/")
            {
                int right = _st.top();
                _st.pop();
                int left = _st.top();
                _st.pop();
                switch (str[0])
                {
                case '+':
                    _st.push(left + right);
                    break;
                case '-':
                    _st.push(left - right);
                    break;
                case '*':
                    _st.push(left * right);
                    break;
                case '/':
                    _st.push(left / right);
                    break;
                }
            }
            else
            {
                _st.push(stoi(str));
            }
        }
        return _st.top();
    }
};